package com.cskaoyan.controller.wx.goods;

import com.cskaoyan.bean.bo.wx.goods.GoodsListBo;
import com.cskaoyan.bean.common.BaseRespVo;
import com.cskaoyan.bean.vo.wx.goods.GoodsRelateVo;
import com.cskaoyan.bean.vo.wx.goods.WxGoodsDetailVo;
import com.cskaoyan.bean.vo.wx.goods.WxGoodsListVo;
import com.cskaoyan.service.wx.goods.WxGoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: bwj
 * @Date: 2022/09/09/16:23
 * @Description:
 */
@RestController
@RequestMapping("wx/goods")
public class WxGoodsController {
    @Autowired
    WxGoodsService wxGoodsService;

    @RequestMapping("count")
    public BaseRespVo<Integer> goodsCount(){
        Integer count=wxGoodsService.goodsCount();
        return BaseRespVo.ok(count);
    }

    @RequestMapping("list")
    public BaseRespVo<WxGoodsListVo> goodsList(GoodsListBo goodsListBo){
        WxGoodsListVo goodsListVo=wxGoodsService.goodsList(goodsListBo);
        return BaseRespVo.ok(goodsListVo);
    }

    /**
    * @Author: 宾文杰 @Description: 商品详情 @Date: 2022/9/9
    */
    @RequestMapping("detail")
    public BaseRespVo<WxGoodsDetailVo> goodsDetail(Integer id){
        WxGoodsDetailVo wxGoodsDetailVo=wxGoodsService.goodsDetail(id);
        return BaseRespVo.ok(wxGoodsDetailVo);
    }

    /**
    * @Author: 宾文杰 @Description: 商品关联 @Date: 2022/9/9
    */
    @RequestMapping("related")
    public BaseRespVo<GoodsRelateVo> goodsRelated(Integer id){
        GoodsRelateVo goodsRelateVo = wxGoodsService.goodsRelated(id);
        return BaseRespVo.ok(goodsRelateVo);
    }
}
